package com.cuanbo.dualscreenteachfu.comparator;

import java.io.File;
import java.util.Comparator;

public class LogDirComparator implements Comparator<File> {
    @Override
    public int compare(File dir1, File dir2) {
        int order = 0;
        int date1 = 0;
        try {
            date1 = Integer.valueOf(dir1.getName());
        } catch (Exception e) {
        }
        int date2 = 0;
        try {
            date2 = Integer.valueOf(dir2.getName());
        } catch (Exception e) {
        }
        if (date1 > date2) {
            order = -1;
        } else if (date1 < date2) {
            order = 1;
        }
        return order;
    }
}
